package net.cjw.initsb.controller.background;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import net.cjw.initsb.common.ServiceResult;
import net.cjw.initsb.utils.SystemUtils;
import net.cjw.initsb.vo.SystemVo;

@Api(description = "系统")
@RestController
@RequestMapping("system")
public class SystemController {

	Logger logger = LoggerFactory.getLogger(this.getClass());

	@GetMapping("v{version}/info")
	public ServiceResult<SystemVo> create(
			@ApiParam(value = "版本号", defaultValue = "1") @PathVariable("version") Integer version) {
		SystemVo vo = null;
		if (version == 1) {
			vo = new SystemVo();
			vo.setJavaHome(SystemUtils.getJavaHome());
			vo.setJavaVersion(SystemUtils.getjavaVersion());
			vo.setOsArch(SystemUtils.getOsArch());
			vo.setOsName(SystemUtils.getOsName());
			vo.setOsVersion(SystemUtils.getOsVersion());
		}
		return ServiceResult.buildSuccess(vo);
	}

}
